package com.bzy.blp.upms.service.impl;

import com.bzy.blp.mapper.TSystemAppInfoDatMapper;
import com.bzy.blp.model.TSystemAppInfoDat;
import com.bzy.blp.model.TSystemAppInfoDatCriteria;
import com.bzy.blp.upms.service.AppService;
import com.bzy.common.exception.LogicException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AppServiceImpl implements AppService {

    @Autowired
    TSystemAppInfoDatMapper tSystemAppInfoDatMapper;


    @Override
    public TSystemAppInfoDat findAppIdByAppKey(String appKey) throws Exception {
        // 获取app应用信息
        TSystemAppInfoDatCriteria criteria = new TSystemAppInfoDatCriteria();
        criteria.createCriteria().andAppKeyEqualTo(appKey);
        List<TSystemAppInfoDat> tSystemAppInfoDats = tSystemAppInfoDatMapper.selectByExample(criteria);
        if (tSystemAppInfoDats == null)
            throw new LogicException("应用不存在");
        return tSystemAppInfoDats.get(0);
    }

    @Override
    public List<TSystemAppInfoDat> findAppList() throws Exception {
        return null;
    }
}
